﻿Public Class frmDoiMatKhau



    Private Sub btnDangNhap_Click(sender As System.Object, e As System.EventArgs) Handles btnDangNhap.Click
        Dim matKhauCu As String = txtMatKhauCu.Text
        Dim matKhauMoi As String = txtMatKhauMoi.Text
        Dim matKhauMoi2 As String = txtMatKhauMoi2.Text

        If (matKhauMoi2 <> matKhauMoi) Then
            MessageBox.Show("Hai mật khẩu mới không giống nhau", "Thông báo")
            Exit Sub
        End If

        If (matKhauCu <> MySession.ThanhVien.MatKhau) Then
            MessageBox.Show("Mật khẩu cũ không đúng", "Thông báo")
            Exit Sub
        End If


        Using db = New QlqaContext
            Dim u = db.ThanhViens.FirstOrDefault(Function(x) x.Id = MySession.ThanhVien.Id)
            u.MatKhau = matKhauMoi
            db.SaveChanges()
        End Using
    End Sub

    Private Sub btnThoat_Click(sender As System.Object, e As System.EventArgs) Handles btnThoat.Click

    End Sub
End Class